<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>获取字符串长度</title>
<script language="javascript" type="text/javascript">
  var str1="十月一日是国庆节";
  var str2="this is a string";
  alert("str1的长度是："+str1.length+"\nstr2的长度是："+str2.length);
</script>
</head>

<body>
  <script>
    var s = new String("abc");
    var s1 = "qwe";
    // 长度 length 属性
    console.log(s1.length);
    console.long(s1.charAt(1));
    console.log(s1.indexOf('e'));
    console.log(s1.lastIndexOf('q'));
    var arr = s1.split('');
    console.log(arr);
    var s2 = "q,w,e";
    console.log(s1.substr(3,3));
    console.log(s1.substring(3,6));

  </script>
</body>
</html>
